import request from '/@/api/request'
/** 接口管理 */

/** 新增接口 */
export const requestAddApi = (data: AddApiTypes.IRequest) => {
  return request.post<IBaseResponse<AddApiTypes.IResponse>>('/manage/openApiInterface/addApi', data)
}
/** 接口列表 */
export const requestApiList = (data: ApiListTypes.IRequest) => {
  return request.post<IBaseResponse<ApiListTypes.IResponse[]>>('/manage/openApiInterface/apiList', data)
}
/** 编辑接口 */
export const requestEditApi = (data: EditApiTypes.IRequest) => {
  return request.post<IBaseResponse<EditApiTypes.IResponse>>('/manage/openApiInterface/editApi', data)
}
/** 删除接口 */
export const requestDeleteApi = (data: DeleteApiTypes.IRequest) => {
  return request.post<IBaseResponse<DeleteApiTypes.IResponse>>('/manage/openApiInterface/deleteApi', data)
}
/** 接口上下架 */
export const requestUpdateApiState = (data: UpdataApiTypes.IRequest) => {
  return request.post<IBaseResponse<UpdataApiTypes.IResponse>>('/manage/openApiInterface/updateApiState', data)
}
/** 接口访问记录 */
export const requestInterfaceRecord = (data: InterfaceAccessRecordApiTypes.IRequest) => {
  return request.post<IBaseResponse<DeleteApiTypes.IResponse>>('/openApiInterfaceLog/getInterfaceLogByPage', data)
}
/** 接口实时访问表格 */
export const requestRealtimeRecord = () => {
  return request.get<IBaseResponse<InterfaceAccessRecordApiTypes.IResponse>>('/openApiInterfaceLog/getInterfaceFlowStatistics')
}
/** 接口实时访问柱状图 */
export const getInterfaceFlowStatisticsChart = () => {
  return request.get<IBaseResponse<InterfaceAccessRecordApiTypes.IResponse>>('/openApiInterfaceLog/getInterfaceFlowStatisticsChart')
}
/** 接口访问统计Echarts */
export const getAccessStatisticsTimeChart = (data) => {
  return request.post<IBaseResponse<InterfaceAccessRecordApiTypes.IResponse>>('/openApiInterfaceLog/getInterfaceStatisticsChart', data)
}
/** 接口访问统计表格分页 */
export const requestInterfaceStatisticsByPage = (data) => {
  return request.post<IBaseResponse<InterfaceAccessRecordApiTypes.IResponse>>('/openApiInterfaceLog/getInterfaceStatisticsByPage', data)
}
